/**
 * @Title：MainAdapter
 * @Description：
 * @author youqd
 * @since 2014年7月17日 下午5:07:22 
 */
package com.threew;

import java.util.List;

import com.meg7.widget.CircleImageView;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView.FindListener;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class MainAdapter extends BaseAdapter{
	
	private List<String> msgList = null;
	private Context context = null;
	
	public MainAdapter(Context context,List<String> msgList) {
		this.msgList = msgList;
		this.context = context;
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return msgList.size();
	}
	
	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
	}
	
	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		View view = LayoutInflater.from(context).inflate(R.layout.theme_item, null);
		TextView text = (TextView)view.findViewById(R.id.title);
		text.setText(msgList.get(arg0));
		
		CircleImageView headView = (CircleImageView)view.findViewById(R.id.head);
		if(arg0 % 2 == 0){
			headView.setImageResource(R.drawable.head);
		}else{
			headView.setImageResource(R.drawable.head2);
		}
		return view;
	}
}
